class CreateSalesQuotations < ActiveRecord::Migration[5.1]
  def change
    create_table :sales_quotations do |t|
      t.integer :firm_id, comment: '相关公司'
      t.string :code, comment: '报价单号'
      t.integer :created_by, comment: '创建人'
      t.float :system_price, comment: '系统报价'
      t.integer :discount, comment: '折扣'
      t.float :final_price, comment: '最终报价'
      t.text :plan_detail, comment: '报价方案'
      t.integer :stage, comment: '报价单状态'
      t.integer :approve_by, comment: '审批人'
      t.datetime :approve_at, comment: '审批时间'

      t.timestamps
    end
    add_index :sales_quotations, :firm_id
    add_index :sales_quotations, :code
    add_index :sales_quotations, :created_by
    add_index :sales_quotations, :stage
    add_index :sales_quotations, :approve_by
    add_index :sales_quotations, :approve_at
  end
end
